/**
 * AJAX state history
 */
var hash = {
	
	init : function() {
		var hash = document.location.hash.substr(1,11);
		if (hash) {
			config.launcher = false;
			$(document).bind("vdjoReady", function() {
				$.getJSON("/video/show/json?id=" + hash, function(data){
					if (!data.video.id) {
						flash.flash("Requested video", "not found");
					} else {
						controller.addToNp(data.video);
						autodj.enable();
					};
				});
			});
		}
	},
	
	setHistory : function(video) {
		document.location.hash = video.id;
	}
	
}

$(document).ready(function() {
	hash.init();
});